package br.gov.sp.guarulhos.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class FabricaDeConexao {

	public static Connection getConexaoMySQL() throws Exception, SQLException{
		try {
			
			Class.forName("com.mysql.jdbc.Driver");
			return DriverManager.getConnection(
						"jdbc:mysql://localhost/agendaj2se",
						"root","root");
		} catch (SQLException e) {
			throw new SQLException();
		} catch (Exception e) {
			throw new Exception();
		}
	}
	
	public static Connection getConexaoPostgreSQL() throws Exception, SQLException{
		try {
			
			Class.forName("org.postgresql.Driver");
			return DriverManager.getConnection(
						"jdbc:postgresql://localhost/agendaj2se",
						"root","root");
		} catch (SQLException e) {
			throw new SQLException();
		} catch (Exception e) {
			throw new Exception();
		}
	}
	
	public static Connection getConexaoOracleXE() throws Exception, SQLException{
		try {
			
			Class.forName("oracle.jdbc.OracleDriver");
			return DriverManager.getConnection(
						"jdbc:oracle:thin:@localhost:1521/XE", 
						"root","root");
		} catch (SQLException e) {
			throw new SQLException();
		} catch (Exception e) {
			throw new Exception();
		}
	}
	
	
}
